new Vue({
	el: '#app',
	data: function () {
		return {
			loading:false,//进去的加载中显示
			host: window.location.protocol+'//'+window.location.host,
			headers:{
				'app-id':'992020022270580001',
				'appId':'992020022270580001',
				'TRANSACTION-ID':this.uuid(),
				'REQ-TIME':this.getDateYYYYMMDDHHMISS(),
				'SIGN':'',
				'user_id':'-1',
				'communityId':this.communityId,
			},
            communityId:'',
			imgList:[
				{src:'../img/banner_s_icon1.png',type:'XCLY'},
                {src:'../img/banner_s_icon2.png',type:'JDZZCZ'},
                {src:'../img/banner_s_icon3.png',type:'RCDS'},
                {src:'../img/banner_s_icon4.png',type:'ZGFB'},
                {src:'../img/banner_s_icon5.png',type:'RJLKBSQ'},
				{src:'../img/banner_s_icon6.png',type:'CMMSGZSQ'}
			],
			token:''
		}
	},
	created() {
        var localStorageCommunityId=JSON.parse(localStorage.getItem('hc_currentCommunityInfo'))
		if(localStorageCommunityId){
			this.communityId=localStorageCommunityId.communityId?localStorageCommunityId.communityId:this.getUrlParam("communityId");
		}else{
			this.communityId=this.getUrlParam("communityId");
		}
		this.token=this.getUrlParam("token");
		this.headers.communityId=this.communityId;
	},
	mounted(){
	},
	filters: {
		subStringThree: function (value) {
			if (!value) return ''
			return value.substring(0,3)
		}
	},
	methods: {
		uuid() {
			let s = [];
			let hexDigits = "0123456789abcdef";
			for (let i = 0; i < 36; i++) {
				s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
			}
			s[14] = "4";  // bits 12-15 of the time_hi_and_version field to 0010
			s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);  // bits 6-7 of the clock_seq_hi_and_reserved to 01
			s[8] = s[13] = s[18] = s[23] = "-";
	
			let uuid = s.join("");
			return uuid;
		},
		getDateYYYYMMDDHHMISS(){
			let date = new Date();
			let year = date.getFullYear();
			let month = date.getMonth() + 1;
			let day = date.getDate();
			let hour = date.getHours();
			let minute = date.getMinutes();
			let second = date.getSeconds();
			if (month < 10) {
				month = '0' + month;
			}
			if (day < 10) {
				day = '0' + day;
			}
			if (hour < 10) {
				hour = '0' + hour;
			}
			if (minute < 10) {
				minute = '0' + minute;
			}
			if (second < 10) {
				second = '0' + second;
			}
			return year + "" + month + "" + day + "" + hour + "" + minute + "" + second;
		},
		getUrlParam(name) {
			var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
			var r = window.location.search.substr(1).match(reg); //匹配目标参数
			if (r != null) return unescape(r[2]);
			return null; //返回参数值	  
		},
		clickImageUrl(type){
			if(type=='ZGFB'){
				window.location.href='/synergism/release.html'
			}else if(type=='RJLKBSQ'){
				window.location.href='/synergism/publicApplication.html?type='+type
			}else if(type=='CMMSGZSQ'){
				window.location.href='/synergism/publicApplication.html?type='+type
			}
			else if(type=='XCLY'){
				window.location.href='https://api-test.999time.cn/postContent?id=461&token='+this.token;
			}
			else if(type=='JDZZCZ'){
				window.location.href='https://api-test.999time.cn/postContent?id=462&token='+this.token;
			}
			else if(type=='RCDS'){
				window.location.href='https://api-test.999time.cn/postContent?id=463&token='+this.token;
			}		
		}
	}
});